<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
	protected function _initAutoload ()
	{
		$this->getResourceLoader()->addResourceType('form_helper', 'forms/helper', 'Form_Helper');
		$this->getResourceLoader()->addResourceType('mapper', 'models/Mapper', 'Model_Mapper');
		Zend_Loader_Autoloader::getInstance()->registerNamespace('viewhelper_');
		Zend_Loader_Autoloader::getInstance()->registerNamespace('Helper_');
		Zend_Loader_Autoloader::getInstance()->registerNamespace('formhelper_');
		Zend_Loader_Autoloader::getInstance()->registerNamespace('validate_');
	}
	
	function _initViewHelpers()
	{
		$this->bootstrap('layout');
		$layout = $this->getResource('layout');
		$view = $layout->getView();
		
		$view->setHelperPath(APPLICATION_PATH . "/helpers" , "");
		Zend_Dojo::enableView($view);
		
		
		$view->doctype('XHTML1_STRICT');
		$view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=iso-8859-1');
		$view->headMeta()->appendName('Sailorbase', 'Social Community');
		$stylelink = "/sailorbase-a/sailorbase-a/public/css/site.css";
		//$stylelink = "http://www.unet.univie.ac.at/~a0947239/sailorbase-a/sailorbase-a/public/css/site.css";
		$view->headLink()->appendStylesheet($stylelink);
		$view->headTitle()->setSeparator(' - ');
		$view->headTitle('Sailorbase');
		
		
		Zend_Dojo::enableView($view);
		$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
		$viewRenderer->setView($view);
	}
	
	// initalisieren von Land und Sprache Buch Seite 295
	protected function _initLocale()
	{
// 		Da zend mit locale auto eine exception werfen kann wird falls dies passiert der Wert auf englisch US gesetzt
		try{
		$locale = new Zend_Locale('auto');
		}
		catch(Zend_Locale_Exception $e){
			$locale = new Zend_Locale('en_US');
		}
		$registry = Zend_Registry::getInstance();
		$registry->set('Zend_Locale', $locale);
	}
	
	protected function _initNavigation()
	{

		$this->bootstrap('layout');
		$layout = $this->getResource('layout');
		$view = $layout->getView();
		$config = new Zend_Config_Xml(
				APPLICATION_PATH . '/configs/navigation.xml');
		$container = new Zend_Navigation($config);
		$view->navigation($container);		
	}
	
// 	Da dojo benutzt wird muss es auch geladen werden
	protected function _initDojo()
	{
		/*
		$view = new Zend_View();
		
		$view->addHelperPath('Zend/Dojo/View/Helper/', 'Zend_Dojo_View_Helper');
		
		$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper(
            'ViewRenderer'
        ); 
		
		$viewRenderer->setView($view);
		
		Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
		*/
		
		
		/*
		// get view resource
		$this->bootstrap('view');
		$view = $this->getResource('view');
		// add helper path to view
		Zend_Dojo::enableView($view);
		// configure Dojo view helper, disable
		$view->dojo()->setCdnBase(Zend_Dojo::CDN_BASE_AOL)
		->addStyleSheetModule('dijit.themes.tundra')
		->disable();
		*/
	}

}

